'use strict';

function grouping_count(collection) {
  collection.sort()
  //在这里写入代码
  var result = {};
  // var num = [];
  // var count = [];
  for (let i = 0; i < collection.length; i++) {
    var count = 1;
    var demo = collection[i].toString();
    for(let j=i+1;j<collection.length;j++){
      if(collection[j]==collection[i]){
        count++;
      }else {
        result[demo] = count;
        i = j-1;
        break;
      }
    }
  }
  return result;
}

module.exports = grouping_count;
